package com.lancoo.ccas53.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.lancoo.ccas53.arrangecourse.entities.ClassHour;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * <p>
 * 课表
 * </p>
 *
 * @author quin.song
 * @since 2024-05-20
 */
@Data
@Accessors(chain = true)
@ApiModel(value = "Schedule对象", description = "课表")
@NoArgsConstructor
public class Schedule implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    private Integer taskId;

    private Long teachingClassId;

    private String teachingClassName;

    private Long courseId;

    private String courseName;

    private Long roomId;

    @ApiModelProperty("timeCode为null时，代表调课模式下处于暂放区")
    private String timeCode;

    @ApiModelProperty("课节所属院系。空字符串表示公共课 其他表示专业课")
    private String collegeId;

    @ApiModelProperty("连上分组标识")
    private String timeGroup;

    @ApiModelProperty("课表所属类型 0:环节  1讲授 2实验 3上机 4其他")
    private Integer hourType;

    @ApiModelProperty("连上节次")
    private Integer connectSection;

    private String week;

    @ApiModelProperty("0：未锁定课表；1：导入的课表；2：锁定的课表")
    private Integer flag;
    private String uniqueGroupSign;

    private String preGroup;


    @TableField(exist = false)
    @ApiModelProperty("教室类型")
    private Integer roomType;


    public Schedule(ClassHour cloneable) {
        this.teachingClassId = cloneable.getCourseUnit().getTeachingClassId();
        this.teachingClassName = cloneable.getCourseUnit().getTeachingClassName();
        this.taskId = cloneable.getCourseUnit().getTaskId();
        this.hourType = cloneable.getCourseUnit().getTeachingType();
        this.flag = cloneable.getCourseUnit().getTeachingClassType();
        this.courseId = cloneable.getCourseUnit().getCourseId();
        this.courseName = cloneable.getCourseUnit().getCourseName();
        this.week = cloneable.getCourseUnit().getClassWeeks();
        this.connectSection = cloneable.getCourseUnit().getConnectSection();
//        this.subTeachingClassId = cloneable.getCourseUnit().getSubTeachingClassId();
        this.timeGroup = cloneable.getCourseUnit().getTimeGroup();
        this.preGroup = cloneable.getCourseUnit().getTimeGroup();
        this.collegeId = cloneable.getCourseUnit().getCollegeId();
        this.uniqueGroupSign = cloneable.getCourseUnit().getSplitClassGroupId();
        this.roomId = cloneable.getCourseUnit().getRoomId();
        if (cloneable.getTimeslotRoom() != null) {
            this.roomId = cloneable.getTimeslotRoom().getRoomId();
            this.timeCode = cloneable.getTimeslotRoom().getTimeslotCode();
        }
    }
}
